package ifosup.julien.socket;
//TOTO
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class ClientSocket implements Runnable {
	private Socket socketServeur;


	@Override
	public void run() {

		System.out.println("tentative de connection");
		try {
			socketServeur = new Socket("127.0.0.1", 4444);
			PrintWriter out = new PrintWriter(socketServeur.getOutputStream()) ;
			Scanner sc = new Scanner(System.in);
			while (true){
				System.out.println("entrer un message :");
				if (sc.hasNext()){
					out.println(sc.nextLine());
					out.flush();
				}
				
			}
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
